<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="module:product:add">
				<i class="fa fa-plus"></i> 批量生成溯源码
			</a>
		<!-- 	<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="module:product:edit">
	            <i class="fa fa-edit"></i> 修改
	        </a> -->
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="module:product:remove">
				<i class="fa fa-remove"></i> 删除
			</a>
		<!-- 	<a class="btn btn-info disabled" onclick="$.operate.detail()" shiro:hasPermission="module:product:detail">
				<i class="fa fa-info-circle"></i> 详情
			</a> -->
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module:product:edit')}]];
    	var listFlag = [[${@permission.hasPermi('system:dict:list')}]];
        var removeFlag = [[${@permission.hasPermi('module:product:remove')}]];
        var datas = [[${@dict.getType('gh_product_type')}]];
        var datas_status = [[${@dict.getType('gh_product_status')}]];
        
        var prefix = ctx + "module/product";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                detailUrl: ctx + "module/productFlowInfo",
                sortName: "id",
		        sortOrder: "desc",
                modalName: "产品",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '主键ID',
					visible: false
				},
				{
					field : 'gardenNo', 
					title : '厂商编号' 
				},
				{
					field : 'productType', 
					title : '产品类型' ,
					align: 'center',
				     formatter: function(value, row, index) {
				            return $.table.selectDictLabel(datas, value);
				       }
				},
				{
					field : 'productCode', 
					title : '溯源码' 
				},
				{
					field : 'status', 
					title : '状态' ,
					align: 'center',
				     formatter: function(value, row, index) {
				            return $.table.selectDictLabel(datas_status, value);
				       }
				},
				{
					field : 'updateTime', 
					title : '更新时间' 
				},
				{
					field : 'remark', 
					title : '备注' 
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> '); */
                        actions.push('<a class="btn btn-info btn-xs ' + listFlag + '" href="#" onclick="detail(\'' + row.id + '\')"><i class="fa fa-list-ul"></i>详情</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
       
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        

		/*字典列表-详细*/
		function detail(id) {
		    var url = prefix + '/detail/' + id;
		    createMenuItem(url, "溯源详情");
		}
    </script>
</body>
</html>